<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - src/scanner.h</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - scanner.h<span style="font-size: 80%;"> (source / <a href="scanner.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">4</td>
            <td class="headerCovTableEntry">4</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66</a>
<span class="lineNum">       2 </span>            : #define SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : #if defined(_MSC_VER) ||                                            \
<span class="lineNum">       5 </span>            :     (defined(__GNUC__) &amp;&amp; (__GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ &gt;= 4) || \
<span class="lineNum">       6 </span>            :      (__GNUC__ &gt;= 4))  // GCC supports &quot;pragma once&quot; correctly since 3.4
<span class="lineNum">       7 </span>            : #pragma once
<span class="lineNum">       8 </span>            : #endif
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : #include &lt;cstddef&gt;
<span class="lineNum">      11 </span>            : #include &lt;ios&gt;
<span class="lineNum">      12 </span>            : #include &lt;map&gt;
<span class="lineNum">      13 </span>            : #include &lt;queue&gt;
<span class="lineNum">      14 </span>            : #include &lt;set&gt;
<span class="lineNum">      15 </span>            : #include &lt;stack&gt;
<span class="lineNum">      16 </span>            : #include &lt;string&gt;
<span class="lineNum">      17 </span>            : 
<span class="lineNum">      18 </span>            : #include &quot;ptr_vector.h&quot;
<span class="lineNum">      19 </span>            : #include &quot;stream.h&quot;
<span class="lineNum">      20 </span>            : #include &quot;token.h&quot;
<span class="lineNum">      21 </span>            : #include &quot;yaml-cpp/mark.h&quot;
<span class="lineNum">      22 </span>            : 
<span class="lineNum">      23 </span>            : namespace YAML {
<span class="lineNum">      24 </span>            : class Node;
<span class="lineNum">      25 </span>            : class RegEx;
<span class="lineNum">      26 </span>            : 
<span class="lineNum">      27 </span>            : class Scanner {
<span class="lineNum">      28 </span>            :  public:
<span class="lineNum">      29 </span>            :   Scanner(std::istream &amp;in);
<span class="lineNum">      30 </span>            :   ~Scanner();
<span class="lineNum">      31 </span>            : 
<span class="lineNum">      32 </span>            :   // token queue management (hopefully this looks kinda stl-ish)
<span class="lineNum">      33 </span>            :   bool empty();
<span class="lineNum">      34 </span>            :   void pop();
<span class="lineNum">      35 </span>            :   Token &amp;peek();
<span class="lineNum">      36 </span>            :   Mark mark() const;
<span class="lineNum">      37 </span>            : 
<span class="lineNum">      38 </span>            :  private:
<span class="lineNum">      39 </span>            :   struct IndentMarker {
<a name="40"><span class="lineNum">      40 </span>            :     enum INDENT_TYPE { MAP, SEQ, NONE };</a>
<span class="lineNum">      41 </span>            :     enum STATUS { VALID, INVALID, UNKNOWN };
<span class="lineNum">      42 </span><span class="lineCov">      62626 :     IndentMarker(int column_, INDENT_TYPE type_)</span>
<span class="lineNum">      43 </span><span class="lineCov">      62626 :         : column(column_), type(type_), status(VALID), pStartToken(0) {}</span>
<span class="lineNum">      44 </span>            : 
<span class="lineNum">      45 </span>            :     int column;
<span class="lineNum">      46 </span>            :     INDENT_TYPE type;
<span class="lineNum">      47 </span>            :     STATUS status;
<span class="lineNum">      48 </span>            :     Token *pStartToken;
<span class="lineNum">      49 </span>            :   };
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span>            :   enum FLOW_MARKER { FLOW_MAP, FLOW_SEQ };
<span class="lineNum">      52 </span>            : 
<span class="lineNum">      53 </span>            :  private:
<span class="lineNum">      54 </span>            :   // scanning
<span class="lineNum">      55 </span>            :   void EnsureTokensInQueue();
<span class="lineNum">      56 </span>            :   void ScanNextToken();
<span class="lineNum">      57 </span>            :   void ScanToNextToken();
<span class="lineNum">      58 </span>            :   void StartStream();
<span class="lineNum">      59 </span>            :   void EndStream();
<a name="60"><span class="lineNum">      60 </span>            :   Token *PushToken(Token::TYPE type);</a>
<a name="61"><span class="lineNum">      61 </span>            : </a>
<a name="62"><span class="lineNum">      62 </span><span class="lineCov">     398723 :   bool InFlowContext() const { return !m_flows.empty(); }</span></a>
<span class="lineNum">      63 </span><span class="lineCov">     441929 :   bool InBlockContext() const { return m_flows.empty(); }</span>
<span class="lineNum">      64 </span><span class="lineCov">     203559 :   std::size_t GetFlowLevel() const { return m_flows.size(); }</span>
<span class="lineNum">      65 </span>            : 
<span class="lineNum">      66 </span>            :   Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const;
<span class="lineNum">      67 </span>            :   IndentMarker *PushIndentTo(int column, IndentMarker::INDENT_TYPE type);
<span class="lineNum">      68 </span>            :   void PopIndentToHere();
<span class="lineNum">      69 </span>            :   void PopAllIndents();
<span class="lineNum">      70 </span>            :   void PopIndent();
<span class="lineNum">      71 </span>            :   int GetTopIndent() const;
<span class="lineNum">      72 </span>            : 
<span class="lineNum">      73 </span>            :   // checking input
<span class="lineNum">      74 </span>            :   bool CanInsertPotentialSimpleKey() const;
<span class="lineNum">      75 </span>            :   bool ExistsActiveSimpleKey() const;
<span class="lineNum">      76 </span>            :   void InsertPotentialSimpleKey();
<span class="lineNum">      77 </span>            :   void InvalidateSimpleKey();
<span class="lineNum">      78 </span>            :   bool VerifySimpleKey();
<span class="lineNum">      79 </span>            :   void PopAllSimpleKeys();
<span class="lineNum">      80 </span>            : 
<span class="lineNum">      81 </span>            :   void ThrowParserException(const std::string &amp;msg) const;
<span class="lineNum">      82 </span>            : 
<span class="lineNum">      83 </span>            :   bool IsWhitespaceToBeEaten(char ch);
<span class="lineNum">      84 </span>            :   const RegEx &amp;GetValueRegex() const;
<span class="lineNum">      85 </span>            : 
<span class="lineNum">      86 </span>            :   struct SimpleKey {
<span class="lineNum">      87 </span>            :     SimpleKey(const Mark &amp;mark_, std::size_t flowLevel_);
<span class="lineNum">      88 </span>            : 
<span class="lineNum">      89 </span>            :     void Validate();
<span class="lineNum">      90 </span>            :     void Invalidate();
<span class="lineNum">      91 </span>            : 
<span class="lineNum">      92 </span>            :     Mark mark;
<span class="lineNum">      93 </span>            :     std::size_t flowLevel;
<span class="lineNum">      94 </span>            :     IndentMarker *pIndent;
<span class="lineNum">      95 </span>            :     Token *pMapStart, *pKey;
<span class="lineNum">      96 </span>            :   };
<span class="lineNum">      97 </span>            : 
<span class="lineNum">      98 </span>            :   // and the tokens
<span class="lineNum">      99 </span>            :   void ScanDirective();
<span class="lineNum">     100 </span>            :   void ScanDocStart();
<span class="lineNum">     101 </span>            :   void ScanDocEnd();
<span class="lineNum">     102 </span>            :   void ScanBlockSeqStart();
<span class="lineNum">     103 </span>            :   void ScanBlockMapSTart();
<span class="lineNum">     104 </span>            :   void ScanBlockEnd();
<span class="lineNum">     105 </span>            :   void ScanBlockEntry();
<span class="lineNum">     106 </span>            :   void ScanFlowStart();
<span class="lineNum">     107 </span>            :   void ScanFlowEnd();
<span class="lineNum">     108 </span>            :   void ScanFlowEntry();
<span class="lineNum">     109 </span>            :   void ScanKey();
<span class="lineNum">     110 </span>            :   void ScanValue();
<span class="lineNum">     111 </span>            :   void ScanAnchorOrAlias();
<span class="lineNum">     112 </span>            :   void ScanTag();
<span class="lineNum">     113 </span>            :   void ScanPlainScalar();
<span class="lineNum">     114 </span>            :   void ScanQuotedScalar();
<span class="lineNum">     115 </span>            :   void ScanBlockScalar();
<span class="lineNum">     116 </span>            : 
<span class="lineNum">     117 </span>            :  private:
<span class="lineNum">     118 </span>            :   // the stream
<span class="lineNum">     119 </span>            :   Stream INPUT;
<span class="lineNum">     120 </span>            : 
<span class="lineNum">     121 </span>            :   // the output (tokens)
<span class="lineNum">     122 </span>            :   std::queue&lt;Token&gt; m_tokens;
<span class="lineNum">     123 </span>            : 
<span class="lineNum">     124 </span>            :   // state info
<span class="lineNum">     125 </span>            :   bool m_startedStream, m_endedStream;
<span class="lineNum">     126 </span>            :   bool m_simpleKeyAllowed;
<span class="lineNum">     127 </span>            :   bool m_canBeJSONFlow;
<span class="lineNum">     128 </span>            :   std::stack&lt;SimpleKey&gt; m_simpleKeys;
<span class="lineNum">     129 </span>            :   std::stack&lt;IndentMarker *&gt; m_indents;
<span class="lineNum">     130 </span>            :   ptr_vector&lt;IndentMarker&gt; m_indentRefs;  // for &quot;garbage collection&quot;
<span class="lineNum">     131 </span>            :   std::stack&lt;FLOW_MARKER&gt; m_flows;
<span class="lineNum">     132 </span>            : };
<span class="lineNum">     133 </span>            : }
<span class="lineNum">     134 </span>            : 
<span class="lineNum">     135 </span>            : #endif  // SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
